Path Shifter
TIME LIMIT = 1 SEC.
- As with nearly everyone else, you like to hang out with your friends at the portico or at other places like the canteen after the last period. And as with nearly everyone else, you get lost in the conversation, laughs, and play and end up losing track of time. But the security guard has blown the first whistle and you know you will miss your bus if you go too late, so you start moving towards your bus. There are two sides that lead to your bus- the left side and the right side and they are represented by 0s and 1s. Example, the left side can be represented as 000111000000111 and the right side can be represented by 000000001110000. You can only travel on the 0s, not on the 1s. You can always switch between the left and right sides anytime during your journey. Your task is to find out whether you will be able to make it to the bus or not. NOTE: The length of both sides will be equal. The length is represented by the letter 'L'.
Input | Output |
The first line will contain the length of both the sides L. The second line will contain the left side. The third line will contain the right side. |
Print "YES" if you can reach your bus, and "NO" if you cannot (without the double quotes). |
- 1 ≤ L ≤ 100